<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <?php
            include("../Service/WebClass/report/AdGroupService.php");
            $AdGroupService = new AdGroupService();

            if(isset($_POST['option']))
            {
                $message = $AdGroupService->updateAdGroup();
                echo "<script language='javascript'>alert(\"".$message."\");window.close();</script>";
            }
        ?>
        <title>広告グループ編集画面</title>
        <link rel="stylesheet" href="../css/common.css" type="text/css" />
        <script language="JavaScript" src="../js/InputCheck.js" type="text/javascript"></script>
    </head>
    <body>
        <div class="input_area">
            <form name="inputform" method="post">
                <input type="hidden" name="option" value="edit"/>
                <table width="100%" border="0" cellpadding="2" cellspacing="0">
                    <tbody><tr>
                            <td align="right">
                                <input class="btn close" onclick="javascript:self.close();" type="button">
                            </td>
                        </tr>
                </tbody></table>
                <span><?php $AdGroupService->getErrorMessage();?></span>
                <table width="100%" border="0" cellpadding="2" cellspacing="0">
                    <tbody><tr>
                            <td align="right">
                                <input class="btn save" value="" onclick="return checkInput_adgroup()" type="submit">
                            </td>
                        </tr>

                </tbody></table>
                <table class="tbl" width="100%" border="0" cellpadding="4" cellspacing="0">
                    <tbody><tr>
                            <td class="td9" width="150" align="left">媒体</td>
                            <td class="td4 left" id="listing_name_display"><?php echo $_POST['listing_name']; ?></td>
                            <input type="hidden" name="listing_name" value="<?php echo $_POST['listing_name']; ?>" />
                        </tr>
                        <tr>

                            <td class="td9 top" align="left">キャンペーン</td>
                            <td class="td4 border"><?php echo $AdGroupService->campaignName;?></td>
                        </tr>
                        <tr>
                            <td class="td9 top" align="left">広告グループID</td>
                            <td class="td4 border"><?php echo $_GET['adGroupId'];?></td>
                        </tr>
                        <tr>
                            <td class="td9 top" align="left"><span class="required">広告グループ名</span></td>
                            <td class="td4 border">
                                <input name="adgroup_name" size="60" maxlength="100" value="<?php echo $_POST['adgroup_name']; ?>" class="txBox" type="text">
                            </td>
                        </tr>

                        <tr style="display:none;">
                            <td class="td9 top" align="left">ランディングページURL(既定値)</td>
                            <td class="td4 border">
                                <input name="landing_url" size="80" maxlength="1000" value="<?php echo $_POST['landing_url']; ?>" class="txBox" type="text">
                                <br>
                                <input name="count_by_creative" id="count_by_creative0" value="0" type="radio"><label for="count_by_creative0">キーワード単位で計測</label>
                                <input name="count_by_creative" id="count_by_creative1" value="1" type="radio"><label for="count_by_creative1">クリエイティブ単位で計測</label>
                                <?php
                                    if($_POST['count_by_creative'] == "0")
                                    {
                                        echo "<script>document.inputform.count_by_creative[0].checked=true;</script>";
                                    }
                                    else
                                    {
                                        echo "<script>document.inputform.count_by_creative[1].checked=true;</script>";
                                    }
                                ?>
                            </td>
                        </tr>

                        <tr>
                            <td class="td9 top">スポンサードサーチ</td>
                            <td class="td4 border">
                                最高入札額
                                <input name="sponsored_maxbid" size="6" maxlength="10" value="<?php echo $_POST['sponsored_maxbid']; ?>" class="txBox" type="text">
                            </td>
                        </tr>
                        <tr>
                            <td class="td9 top">コンテンツマッチ</td>
                            <td class="td4 border">
                                最高入札額
                                <input name="content_maxbid" size="6" maxlength="10" value="<?php echo $_POST['content_maxbid'];?>" class="txBox" type="text">
                            </td>
                        </tr>
                        <tr>
                            <td class="td9 top" align="left">
                                除外ワード
                                <input class="btn" value="編集" onclick="window.open('../plan/excludedKeyEdit.php?groupId=<?php echo $_GET['adGroupId'];?>')" type="button">
                            </td>

                            <td class="td4 border" id="excluded_word_list">&nbsp;<?php echo $_POST['excluded_word_list'];?></td>
                            <input type="hidden" name="excluded_word_list" value="<?php echo $_POST['excluded_word_list'];?>"/>
                        </tr>
                        <tr>
                            <td class="td9 top" align="left">掲載オン/オフ</td>
                            <td class="td4 border">
                                <input name="status" id="status1" value="1" type="radio"><label for="status1">オン</label>
                                <input name="status" id="status0" value="0" type="radio"><label for="status0">オフ</label>
                                <?php
                                    if($_POST['status'] == "1")
                                    {
                                        echo "<script>document.inputform.status[0].checked=true;</script>";
                                    }
                                    else
                                    {
                                        echo "<script>document.inputform.status[1].checked=true;</script>";
                                    }
                                ?>
                            </td>
                        </tr>
                        <tr>
                            <td class="td9 top">タイマー入札</td>
                            <td class="td4 border"><input type="button" value="編集" class="btn btn_wider" onclick="window.open(<?php echo '\'../timer/AdGroupTimerList.php?listingType='.$_GET['listingType'].'&camp_Id='.$_GET['campaignId'].'&adGr_Id='.$_GET['adGroupId'].'\''; ?>);"/></td>
                        </tr>
                </tbody></table>
                <table width="100%" border="0" cellpadding="2" cellspacing="0">
                    <tbody><tr>
                            <td align="right">
                                <input class="btn save" value="" onclick="return checkInput_adgroup()" type="submit">
                            </td>
                        </tr>

                </tbody></table>
            </form>
        </div>
        <?php
            include(dirname(__FILE__)."/../Service/WebClass/report/Init.php");
            if(!isset($_POST['option']))
            {
                adGroupLoadData();
            }
        ?>
    </body>
</html>
